import React, { Component } from 'react';
import {
    Flex,
    InputItem,
    Button,
    Icon,
    Accordion, List
} from 'antd-mobile';
import CanChangeScroll from '../../components/CanChangeScroll/CanChangeScroll';
import CanChangeScrollX from '../../components/CanChangeScrollX/CanChangeScrollX';
import MyScroll from '../../components/MyScroll/MyScroll';
import Filter from './filer';

import {allClass, spec_filter} from './specFilter.less';
import {routerRedux} from "dva/router";


class AllClass extends Component {
    constructor(props) {
        super(props);
    }




    submit = () => {
        this.props.onOpenChangeTwo();
    }
    getAlloyTouch = (AT) =>{
        this.AlloyTouch = AT;
    };
    onChange = (key) => {
        console.log(key);
    }
    render() {
        const { classList,dispatch } = this.props;
        console.log(classList);
        return (
            <Flex style={{
                backgroundColor:'#fff',
                height:"100%"
            }} direction="column"
                  className={allClass}
            >
                <CanChangeScroll style={{width:"100%",height:"100%"}} wrapperId="classWraperId" targetId="classTargetId">
                    {classList.map((v,i)=>{
                        console.log(v.goodClassCustomEntity)
                        if(v.goodClassCustomEntity!=""){
                            return v.goodClassCustomEntity.map((val,idx)=>{
                                return <Accordion key={idx} style={{width:"100%"}}  >
                                    <Accordion.Panel  header={val.name}>
                                        <List className="my-list">
                                            {(val.classCustomList==""?[]:val.classCustomList).map((value,ide)=>{
                                                return  <List.Item key={ide} onClick={()=>{
                                                    this.props.dispatch(routerRedux.push(`/goodsearch/gcIdSearch?keyword=${value.id}&showKeyword=${encodeURIComponent(value.name)}`));
                                                    // location.reload();
                                                    this.props.onOpenChangeTwo();
                                                }}>{value.name}</List.Item>
                                            })}
                                        </List>
                                    </Accordion.Panel>
                                </Accordion>
                            })
                        }

                    })}

                </CanChangeScroll>



            </Flex>
        )
    }
}

export default AllClass;
